package utils;

import java.util.Random;

/**
 * Generates random integers
 */
public class RandomGenerator {

	// seed for pseudo-random choices
	private static long seed = /*1398784932967L;*/ /*1398788046954L;*/ System.currentTimeMillis();
	
	// random generator
	private static Random RND = new Random(seed);	
	
	public static void showSeed() {
		System.out.println(seed);
	}
	
	/**
	 * Returns a random integer in range [0,n)
	 * @param n- maximal bound for choice range 
	 * @return random choice
	 */
	public static int nextInt(int n) {
		if(n==0)
		{
			n=1;;
		}
		return RND.nextInt(n);
	}
	
	/**
	 * Returns a random floating point number in range [0,1)
	 * @return random choice
	 */
	public static double nextDouble() {
		return RND.nextDouble();
	}
	
	/**
	 * Returns a random floating point number in range [0,1)
	 * @return random choice
	 */
	public static float nextFloat(int range) {
		return RND.nextFloat()*range*2 - range;
	}
	
	/**
	 * Returns a random floating point number in range [0,1)
	 * @return random choice
	 */
	public static float nextFloat(float range) {
		return RND.nextFloat()*range*2 - range;
	}
}